package com.shark.open.config;

import com.shark.utils.web.interceptor.LogTraceInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Resource
    private ContextInterceptor contextInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LogTraceInterceptor()).addPathPatterns("/**");/*日志链拦截器*/
        registry.addInterceptor(contextInterceptor).addPathPatterns("/api/**")
                .excludePathPatterns("/api/work/**");
    }

}
